<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/classes/DBHelper.class.jsp"%>
<%@ include file="/classes/CommonHelper.class.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String guid = getParameter(request,"guid");
	if(nullOrEmpty(guid)){
		out.print("<script>alert(\"参数错误\");</script>");
		return;
	}
	String userid=(String)session.getAttribute("userId");
	String sql = "select t1.*,t2.name dept_name from app_myzj_info t1 left join cms_department t2 on t1.dept_code = t2.code_name where t1.guid = ?";
	Map<String,Object> info = getObject(sql,new Object[]{guid});
	
	pageContext.setAttribute("info",info);
%>
<html>
<head>
<title>民意征集-后台修改</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script charset="utf-8" src="editor/kindeditor.js"></script>
<script charset="utf-8" src="editor/lang/zh_CN.js"></script>
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="../js/dialog/lhgdialog/lhgdialog.min.js?skin=chrome"></script>
<script type="text/javascript">
KindEditor.ready(function(K) {
        window.editor = K.create('#content', {
			cssPath : 'editor/plugins/code/prettify.css',
			uploadJson : 'editor/jsp/upload_json.jsp',
			fileManagerJson : 'editor/jsp/file_manager_json.jsp',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});  
			} 
		}); 
});
</script>
<script type="text/javascript">
	$(function(){
		var userid='<%=userid%>';
		$('#website_code').dialog({ 
				content:'url:/website-webapp/check/js/dialog/website.jsp?userid='+userid+'&text=website_code' ,
				lock:true,
				drag:true,
				min:false,
				max:false,
				title:"<div style='float: left;'>所属站点<div>",
				width:640,
				height:440
							 
			});   
		});
</script>
</head>
<body>
	<form action="myzj_modify_do2.jsp?r=<%=new Date().getTime() %>" method="post">
		<table width="100%">
			<tr>
				<td width="120px">征集标题</td>
				<td align="left"><input type="text" name="title" id="title" value="${info.title }"> </td>
			</tr>
			<tr>
				<td width="111" style=" height:40px; line-height:40px; ">选择站点</td>
				<td width="609" align="left"><input type="text" name="website_code" id="website_code" style=" width:250px;" value="${info.website_code }" readonly> </td>
			</tr>
			<tr>
				<td>征集内容</td>
				<td align="left">
					<div class="manuscript-left-box" id="shite1">
					<textarea id="content" name="content" style="width:600px;height:360px;visibility:hidden;">${info.content }</textarea>
					</div>
				</td>
			</tr>
			<tr style="display: none;">
				<td>发布部门</td>
				<td align="left">
					<c:if test="${info.dept_name == null}">
					<input type="text" id="dept_name" name="dept_name" value="请点击选择部门" onClick="openbm()"  readonly="readonly" >
					</c:if>
					<c:if test="${info.dept_name != null}">
					<input type="text" id="dept_name" name="dept_name" value="${info.dept_name }" onClick="openbm()"  readonly="readonly" >
					</c:if>
					<input type="hidden" id="dept_code" name="dept_code" value="${info.dept_code }" >
			</tr>
			<tr>
            	<td style=" height:40px; line-height:40px; "> 开始时间1</td>
				<td align="left">
					<input type="text" name="kssj" value="<c:if test="${!empty info.create_time }"><fmt:formatDate value="${info.create_time }" pattern="yyyy-MM-dd"/></c:if>" class="Wdate" readonly="readonly" style="width: 160px;" onclick="WdatePicker()"/>
                </td>      
            </tr>
            <tr>
            	<td style=" height:40px; line-height:40px; "> 截止时间2</td>
				<td align="left">
					<input type="text" name="jzsj" value="<c:if test="${!empty info.end_time }"><fmt:formatDate value="${info.end_time }" pattern="yyyy-MM-dd"/></c:if>" class="Wdate" readonly="readonly" style="width: 160px;" onclick="WdatePicker()"/>
                </td>  
            </tr>
			<tr>
				<td>立即发布</td>
				<td align="left">
					<c:if test="${info.status=='1' }">
					<input type="radio" name="status" value="1" checked="checked">是
					<input type="radio" name="status" value="2">否
					</c:if>
					<c:if test="${info.status!='1' }">
					<input type="radio" name="status" value="1" >是
					<input type="radio" name="status" value="2" checked="checked">否
					</c:if>
				</td>  
			</tr>
			<tr>
				<td colspan="2" >
					<input type="hidden" name="guid" value="${info.guid }">
					<input type="hidden" name="isModify" value="true" >
				<input type="submit" value="提交" width="80px" height="40px">
				<input type="button" value="返回" width="80px" onClick="window.location.href='myzj_list.jsp?r=<%=new Date().getTime() %>'" height="40px">
				</td>
			</tr>
		</table>
	</form>
	<script type="text/javascript">
	function openbm(){
		var rsName = window.showModalDialog("bmlist.html","bmlist","dialogWidth=1024px;dialogHeight=768px");
		var str = rsName.split(";");
		document.getElementById("dept_name").value=str[1];
		document.getElementById("dept_code").value=str[0];
	}
	</script>
</body>
</html>